package cn.yunhe.interceotor;

import org.apache.struts2.ServletActionContext;

import com.opensymphony.xwork2.ActionInvocation;
import com.opensymphony.xwork2.interceptor.MethodFilterInterceptor;

import cn.yunhe.model.UserRegs;

public class LoginIntercept extends MethodFilterInterceptor {

	//登錄攔截器
	protected String doIntercept(ActionInvocation invocation) throws Exception {
		UserRegs user=(UserRegs) ServletActionContext.getRequest().getSession().getAttribute("userRegs");
		if(user==null) {
			return "loginError";
		}else {
			return invocation.invoke();
		}
	}
}
